enum OrderStatus {
  CREATED = "created",
  TO_PAY = "to_pay",
  PENDING = "pending",
  PAYED = "payed",
  DELIVERED = "delivered",
  PREPARED = "prepared",
  CANCELLING = "cancelling",
  FINISHED = "finished",
  BEFORE_PAY_CLOSED = "before_pay_closed",
  AFTER_PAY_CLOSED = "after_pay_closed",
}

export const isOrderStatus = (val: any): val is OrderStatus => {
  return [
    OrderStatus.CREATED,
    OrderStatus.TO_PAY,
    OrderStatus.PENDING,
    OrderStatus.PAYED,
    OrderStatus.DELIVERED,
    OrderStatus.PREPARED,
    OrderStatus.CANCELLING,
    OrderStatus.FINISHED,
    OrderStatus.BEFORE_PAY_CLOSED,
    OrderStatus.AFTER_PAY_CLOSED,
  ].includes(val);
};

export default OrderStatus;
